<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>魏远商城</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<link rel="shortcut icon" href="/favicon.ico">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" type="text/css" href="css/corporate-welfare.css" />
		<link rel="stylesheet" href="css/my-order.css" />
		<link rel="stylesheet" href="css/style.css" />
	</head>

	<body style="background: white;">
		<header class="bar bar-nav return-header" style="width: 100%;">
			<span class="order-back mui-action-back"><img src="img/back-le.png" height="50%"/></span>
			<h1 class="title" style="line-height: 2.2rem;">企业福利</h1>
		</header>
		<div class="mui-content">
			<div class="img1"></div>
			<div class="top">套餐</div>
			<div class="combo">
				<!--<div class="content">
				    	<div style="background-image: url(img/poduct.png);background-size:cover ;background-position: center;background-repeat: no-repeat;"></div>
				    	<div class="main" style="border: 0px;">
				    		<p>套餐1</p>
				    		<p>红心超甜，人人爱吃</p>
				    		<p><span>14.9</span>元/1个<img src="img/corporate2.png"></p></div>
				    </div>
				     <div class="content">
				    	<div style="background-image: url(img/fruit-banner3@2x.png);background-size:cover ;background-position: center;background-repeat: no-repeat;"></div>
				    	<div class="main" style="border: 0px;">
				    		<p>套餐2</p>
				    		<p>红心超甜，人人爱吃</p>
				    		<p><span>14.9</span>元/1个<img src="img/corporate2.png"></p></div>
				    </div>			    			    -->
			</div>
			<div class="top">单品</div>
			<div class="content1">
				<!--<div><p style="background-image: url(img/fruit-banner2@2x.png);background-size: cover;background-position:center;"></p><p><span>B级-杨桃</span><span>约22.2g/份</span><span><span style="font-size: 14px;">￥</span>10.9</span></p></div>
				<div><p style="background-image: url(img/fruit-banner2@2x.png);background-size: cover;background-position:center;"></p><p><span>B级-杨桃</span><span>约22.2g/份</span><span><span style="font-size: 14px;">￥</span>10.9</span></p></div>
				<div><p style="background-image: url(img/fruit-banner2@2x.png);background-size: cover;background-position:center;"></p><p><span>B级-杨桃</span><span>约22.2g/份</span><span><span style="font-size: 14px;">￥</span>10.9</span></p></div>-->
			</div>

		</div>
		<div style="height: 1px;"></div>
		<script src="js/jquery-3.1.1.min.js"></script>
		<script src="js/mui.min.js"></script>
		<script src="js/url.js"></script>
		<script type="text/javascript">
			/*点击进入详情页面*/
			$('.content1').on('tap', '.home-dan', function() {
				//				alert(111);
				href('details.html', $(this).attr('id'));
			});
			$('.combo').on('tap', '.content', function() {
				//				alert(111);
				href('details.html', $(this).attr('id'));
			});

			function href(a, c) {
				localStorage.whereId = c;
				mui.openWindow({
					url: a,
					show: {
						aniShow: 'pop-in'
					}
				})
			}

			/*获取商品*/
			$(function() {
				$.ajax({
					url: ur + '/mobile/product/getProductListByEnterpriseId',
					type: 'POST',
					headers: {
						"X-Token": localStorage.token
					},
					dataType: 'json',
					data: {
						"enterpriseId": localStorage.priseId,

					},
					success: function(data) {

						console.log(data);
						$('.img1').text(data.result.data.enterpriseName);
						console.log(data.result.data.combinationPVo.length);
						for(var i = 0; i < data.result.data.combinationPVo.length; i++) {
							var b = data.result.data.combinationPVo[i].mainImg;
							var m = b.indexOf(',');
							if(m != '-1') {
								var mainImg = b.substring(0, m);
							} else {
								mainImg = b;
							}

							console.log(data.result.data.combinationPVo[i].mainImg);
							var div = ('<div class="content" id="' + data.result.data.combinationPVo[i].id + '">' +
								'<div style="background-image:url(' + picur + mainImg + ');background-size:cover ;background-position: center;background-repeat: no-repeat;"></div>' +
								'<div class="main" style="border: 0px;">' +
								'<p>' + data.result.data.combinationPVo[i].shortname + '</p>' +
								'<p>' + data.result.data.combinationPVo[i].description + '</p>' +
								'<p><span>' + data.result.data.combinationPVo[i].newPrice + '</span>元<img src="img/corporate2.png"></p></div>' +
								'</div>');

							$('.combo').append(div);
						}
						for(var u = 0; u < data.result.data.productVOs.length; u++) {
							var b = data.result.data.productVOs[u].mainImg;
							//													console.log(b.indexOf(',') + '逗号索引值');
							var m = b.indexOf(',');
							if(m != '-1') {
								var mainImg = b.substring(0, m);
							} else {
								mainImg = b;
							}
							var divdan = ('<div class="home-dan" id="' + data.result.data.productVOs[u].id + '"><p style="background-image: url(' + picur + mainImg + ');background-size: cover;background-position:center;"></p><p><span>' + data.result.data.productVOs[u].shortname + '</span>' +
								'<span>' + data.result.data.productVOs[u].description + '</span>' +
								'<span><span style="font-size: 14px;">￥</span>' + data.result.data.productVOs[u].newPrice + '</span></p></div>');
							$('.content1').append(divdan);

						}

					}
				})

			})
		</script>
	</body>

</html>